from sqlalchemy import create_engine,Column,String
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm.session import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from uuid import uuid4

db = create_engine('mysql+pymysql://root:123@localhost:3306/graphql')
db_session = scoped_session(sessionmaker(bind=db))
Base = declarative_base()

class EmployeeModel(Base):
    __tablename__ = 't_employee'
    id = Column(String(128),primary_key= True)
    name = Column(String(64))

# Base.metadata.create_all(bind =db)
def init_db():
    for i in range(10):
        emp = EmployeeModel(id=uuid4().hex,name=f'e{i}')
        db_session.add(emp)
    db_session.commit()

init_db()